<?php
// +----------------------------------------------------------------------
// | CoreThink [ Simple Efficient Excellent ]
// +----------------------------------------------------------------------
// | Copyright (c) 2014 http://www.corethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: jry <598821125@qq.com> <http://www.corethink.cn>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
/**
 * 后台标签控制器
 * @author jry <598821125@qq.com>
 */
class SupportController extends AdminController{
    /**
     * 标签列表
     * @author jry <598821125@qq.com>
     */
    

    /**
     * 编辑标签
     * @author jry <598821125@qq.com>
     */
    public function edit(){
        if(IS_POST){
            $tag_object = D('Service');
            $data = $tag_object->create();
            if($data){
                if($tag_object->save()!== false){
                    $this->success('更新成功', U('edit'));
                }else{
                    $this->error('更新失败');
                }
            }else{
                $this->error($tag_object->getError());
            }
        }else{
            //使用FormBuilder快速建立表单页面。
            $builder = new \Common\Builder\FormBuilder();
            $builder->setMetaTitle('Service') //设置页面标题
                    ->setPostUrl(U('edit')) //设置表单提交地址
                    ->addFormItem('id', 'hidden', 'ID', 'ID')
                    ->setFormData(array('id'=>'2'))
                    ->addFormItem('content', 'kindeditor', '買賣須知')
                    ->setFormData(D('Service')->find('2'))
                    ->display();
        }
    }
}
